package org.example.struct.array3;

import java.util.Arrays;
import java.util.PriorityQueue;

/**
 * @author liyishan
 * @date 2024/3/9 09:39
 * @apiNote
 */

public class Test02386KSum {

    public long kSum(int[] nums, int k) {
        int n = nums.length;
        long total = 0;
        for(int i = 0; i < n; i++){
            if(nums[i] >= 0){
                total += nums[i];
            }else{
                nums[i] = -nums[i];
            }
        }
        Arrays.sort(nums);
        long ret = 0;
        PriorityQueue<long[]> pq = new PriorityQueue<>((a, b) -> (int) (b[0] - a[0]));
        pq.offer(new long[]{nums[0],0});

        return total;
    }
}
